
getmyData('contentListData', contentListData)
var benDiDang3 = getmyData('contentListData')
if (benDiDang3 == null) {
    setmyData('contentListData', contentListData)
    benDiDang3 = getmyData('contentListData')
}

// 当前页
let myPageUl_num = 1

// tbody渲染内容
function showTable_two(data) {
    myTbody_th.innerHTML = ""
    data.forEach(item => {
        myTbody_th.innerHTML += ` 
                        <div class="myTbody_th">
                              <div class="myTbody_th_left">
                                  <img src="${item.contentListImg}" alt="">
                              </div>
                              <div class="myTbody_th_right">
                                  <h4>${item.contentListHt}</h4>
                                  <p class="myTbody_th_title">${item.contentListRy}<p>
                                  <div class="myTbody_th_right_right_abr"> 
                                      <span> <span class="iconfont icon-ren"></span>${item.contentListUser}</span>  <span>2020-7-11 15:00</span>
                                      <span class="myTbody_th_delt" onclick="myExamine(${item.contentListId})">审核</span>                                       
                                  </div>
                              </div>
                              </div>
                        </div> 
                             `
    });
}

let zxMaxPage

// 限制每页数据
function limitPage(data) {
    // 当前页
    let goPage1 = (data - 1) * 5
    let stopPage = benDiDang3.slice(goPage1, goPage1 + 5)
    showTable_two(stopPage)
}
limitPage(myPageUl_num)


// 动态输出页码
function GetPageNumber(data) {
    let myPageUl_th = document.getElementById('myPageUl_th')
    //共多少记录
    let gongDuoShao = `<li class="myPageUlToTal">共 <span class="myPageUlToTal_shuzi"> 0 </span> 条记录 第<span class="myPageUlToTal_ji"> 1 </span> / <span class="myPageUlToTal_yigong"> 0 <span> 页 </li>`

    // 页码
    zxMaxPage = Math.ceil(data.length / 5)
    // 上一页
    let zpre = `<li class="myPageUlPress_shang iconfont icon-xiangzuo"></li>`
    let zstr = ''
    // 页码数循环添加页码
    for (let i = 1; i <= zxMaxPage; i++) {
        zstr += `<li class="myPageUlPress"   data-num_th='${i}'>${i}</li>`
    }
    // 字符串拼接  下一页
    zstr = gongDuoShao + zpre + zstr + `<li class="myPageUlPress_xia iconfont icon-xiangyou1"></li>`
    myPageUl_th.innerHTML = zstr

    two_dangqianye()
    twoYiGongDuoShao()
}
GetPageNumber(benDiDang3)


// 点击几到几页
$('#myPageUl_th').on('click', '.myPageUlPress', function () {
    myPageUl_num = $(this).attr('data-num_th')
    limitPage(myPageUl_num)
    // $('.myPageUlToTal_ji').html(myPageUl_num)
    two_dangqianye()
})


// 给上一页绑定点击事件
$('#myPageUl_th').on('click', '.myPageUlPress_shang ', function () {
    if (myPageUl_num != 1) {
        myPageUl_num--
        limitPage(myPageUl_num)
    }
    two_dangqianye()
    // $('.myPageUlToTal_ji').html(myPageUl_num)

})

function two_dangqianye() {
    $('.myPageUlToTal_ji').html(myPageUl_num)
}
two_dangqianye()


// 下一页绑定点击事件
$('#myPageUl_th').on('click', '.myPageUlPress_xia', function () {
    if (myPageUl_num < zxMaxPage) {
        myPageUl_num++
        limitPage(myPageUl_num)
    }
    // $('.myPageUlToTal_ji').html(myPageUl_num)
    two_dangqianye()
})

// 页码显示共多少条记录
function duoShaoYe() {
    $('.myPageUlToTal_shuzi').html(benDiDang3.length)
}
duoShaoYe()

// 一共多少也
function twoYiGongDuoShao() {
    $('.myPageUlToTal_yigong').html(Math.ceil(benDiDang3.length / 5))
}
twoYiGongDuoShao()


// 审核
function myExamine(data) {
    location.href = "./zx_03_2.html"
}